package restful.struts2;

import org.apache.struts2.dispatcher.mapper.*;

import restful.*;


public class RestfulActionMapping extends ActionMapping {
	private String uri;

	private RestfulMethod restfulMethod;

	public RestfulActionMapping(String uri, RestfulMethod method) {
		this.uri = uri;
		this.restfulMethod = method;

		setNamespace("");

		setName(method.getTopicAsCamelCase());
		setMethod(method.getSignature());

		if (getParams() != null) {
			getParams().putAll(method.getValues());
		}
		if (getParams() == null) {
			setParams(method.getValues());
		}
	}

	public RestfulMethod getRestfulMethod() {
		return restfulMethod;
	}

	public String getUri() {
		return uri;
	}
}
